$(document).ready(function(){
	$('#login_button').click(function() {
		login();
	});
	$('#logout_button').click(function() {
		logout();
	});
	
	$('#help_button').click(function() {
		alert( 'help - TO DO, BUILD HELP' );
	});
	
	$('#settings_button').click(function() {
		// load settings from store and make sure we persist radio buttons.
		$('#settings').show();
		$('#welcome').hide();		
	});
	
	$('#settings_save_button').click(function () {
		$('#settings').hide();
		$('#welcome').show();
	});
	$('#addtime_button').click(function() {
		alert('we need to build this');
	});
	$('#map_button').click(function() {
		try{
			var path = ""; 
	        navigator.geolocation.getCurrentPosition(function (position) {
	        	$('#lat').val( position.coords.latitude ); 
	        	$('#long').val( position.coords.longitude ); 
	            path = 'http://maps.google.com/maps/api/staticmap?center=' + $('#lat').val() + ',' + $('#long').val() + '&zoom=12&size=250x250&maptype=static&markers=color:red|label:P|&sensor=false';
	            alert( path );
		        x$('img#static_map').attr('src', path);
	        });
	    }catch(err){
	    	alert( 'map display error:' + err );
	    	x$('img#static_map').attr('src', "assets/img/gpsfailed.png");
		}
		$('#map').show();
		$('#welcome').hide();		
	});
	
	$('#map_back_button').click(function () {
		$('#map').hide();
		$('#welcome').show();
	});
});
    